#include "StdAfx.h"
#include "ObjectBase.h"
#include <stdlib.h>


ObjectBase::ObjectBase(void)
{
	printf("ctor\t%s\n", __FUNCTION__);
	This = (int) this;
}

ObjectBase::ObjectBase( const ObjectBase& Source )
{
	printf("cpytor\t%s\n", __FUNCTION__);
	This = Source.This;
}

ObjectBase::~ObjectBase(void)
{
	printf("dtor\t%s\n", __FUNCTION__);
	This = 0;
}


// test for identity
bool ObjectBase::Equals(const ObjectBase& Source) const
{
	printf("%s\n", __FUNCTION__);
	return this == &Source;
}

ObjectBase& ObjectBase::operator=( const ObjectBase& Source )
{
	printf("assign\t%s\n", __FUNCTION__);
	if (Equals(Source))
		return *this;

	This = Source.This;

	return *this;
}

void * ObjectBase::operator new( const size_t Size )
{
	printf("new\t%s\n", __FUNCTION__);
	return malloc(Size);
}

void ObjectBase::operator delete( void *Ptr )
{
	printf("delete\t%s\n", __FUNCTION__);
	free(Ptr);
}
